cellarea: Don't shrink area too much
authorBenjamin Otte <otte@redhat.com>
Tue, 15 Jun 2021 17:34:37 +0000 (19:34 +0200)
committerBenjamin Otte <otte.benjamin@googlemail.com>
Tue, 15 Jun 2021 18:00:25 +0000 (18:00 +0000)
Do not compute rectangles with negative width/height. This avoids
assertion failures further down when those rectangles were actually
checked.

https://bugzilla.redhat.com/show_bug.cgi?id=1962215

(cherry picked from commit 4ba89f25b8a88616afc1915bdb4fb87d13efae6f)

gtk/gtkcellarea.c

index a46d50900ba708ff1d74980004fd602f7b31696a..7541e60ef8aac4c266580a1552f897c98cf29051 100644 (file)
@@ -3423,8 +3423,18 @@ gtk_cell_area_inner_cell_area (GtkCellArea        *area,
 
   *inner_area = *cell_area;
 
+  if (border.left + border.right > cell_area->width)
+    {
+      border.left = cell_area->width / 2;
+      border.right = (cell_area->width + 1) / 2;
+    }
   inner_area->x += border.left;
   inner_area->width -= border.left + border.right;
+  if (border.top + border.bottom > cell_area->height)
+    {
+      border.top = cell_area->height / 2;
+      border.bottom = (cell_area->height + 1) / 2;
+    }
   inner_area->y += border.top;
   inner_area->height -= border.top + border.bottom;
 }